import { Element } from '../../../fieldType'
import commonField from '../../../propertyPanel/commonConfig'
export const fields = [
  { label: '备件名称', value: 'name' },
  { label: '类型', value: 'typeId' },
  { label: '型号', value: 'model' },
  { label: '单位', value: 'unitId' },
  { label: '销售价', value: 'price' },
  { label: '使用数量', value: 'spareCount' },
  { label: '仓库', value: 'wareHouseId' },
  { label: '备件编号', value: 'spareNumber' }
]
export const fieldsMap = {
  spareNumber: '备件编号',
  wareHouseId: '仓库',
  name: '备件名称',
  typeId: '类型',
  model: '型号',
  unitId: '单位',
  price: '销售价',
  spareCount: '使用数量',
  oper: '操作'
}
export interface AssociateSpareElement extends Element {
  displayField: any[],
  width: number
}
function formListFactory () {
  return [
    commonField.name,
    commonField.attrCode,
    { label: '展示字段', name: 'displayField', type: 'slot' },
    commonField.width
  ]
}
const formList = formListFactory()
const formTemplate: AssociateSpareElement = {
  attrCode: '',
  businessId: '',
  name: '关联备件',
  fieldType: 'associateSpare',
  displayField: ['name', 'spareCount'],
  width: 1
}
export default {
  formList,
  formTemplate
}
